<template>
  <div class="top-header">
    <el-row :gutter="10" type="flex" align="conter" style="width:100%">
      <el-col :xs="3" :sm="6" :md="4" :lg="3" :xl="1">
        <img class="top-img" src="@/assets/log.png" alt="" />
      </el-col>
      <el-col :xs="21" class="col-right">
        <el-col
          :xs="5"
          :sm="3"
          :md="2"
          :lg="2"
          :xl="1"
          v-for="(item, i) in links"
          :key="i"
        >
          <button
            class="bttn-slant bttn-sm bttn-primary"
            @click="handleBtn(item.path)"
          >
            {{ item.name }}
          </button>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  props: {
    links: {
      type: Array,
      default: () => {
        return [];
      },
    },
  },
  methods: {
    handleBtn(path) {
      if (path === "gitee") {
        window.open(`https://gitee.com/zhengwei66`);
      } else {
        this.$router.push(path);
      }
    },
  },
};
</script>

<style lang="less" scoped>
.top-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #2f3641;
  // background: transparent;
  // border-bottom: 1px solid #aaa;
  padding-left: 30px;
  z-index: 2000;
  .top-img {
    width: 40px;
    height: 40px;
    border-radius: 5px;
  }
  .top-btn {
    display: inline-block;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    background: #fff;
    border: 1px solid #dcdfe6;
    border-color: #dcdfe6;
    color: #065798;
    -webkit-appearance: none;
    text-align: center;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    outline: none;
    margin: 0;
    -webkit-transition: 0.1s;
    transition: 0.1s;
    font-weight: 500;
    padding: 6px 10px;
    font-size: 14px;
    border-radius: 4px;
  }
  .top-btn + .top-btn {
    margin-left: 10px;
  }
}
.col-conter {
  display: flex;
  align-items: center;
}

.col-right {
  display: flex;
  align-items: center;
  justify-content: end;
}
</style>
